home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-PR / Interfaces&Libraries / Interfaces / RIncludes / SIOW.h next >
Encoding:
C/C++ Source or Header  |  1998-11-30  |  7.2 KB  |  221 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #    SIOW.h
  3. #    Simple Inpue/Output Window header
  4. #    Apple Copyright 1989-1998
  5. #
  6. #    The names for these constants have been selected to satisfy both the
  7. #    standards set up by Apple for applications, and by ANSI for C programming.
  8. #
  9. #-----------------------------------------------------------------------------*/
  10.  
  11. #ifndef __SIOW__
  12. #define __SIOW__
  13.  
  14. #ifndef REZ
  15. #include <Types.h>
  16. #include <Events.h>
  17. #endif
  18.  
  19. #ifndef __kPrefSize
  20. #define __kPrefSize            350        /* Default max app size */
  21. #endif
  22. #ifndef __kMinSize
  23. #define __kMinSize            250        /* Default min app size */
  24. #endif
  25.  
  26. /* The following constants are used to identify menus and their items. */
  27. /* NOTE: resources IDs 20000-20010 are reserved fur use by SIOW */
  28.  
  29. #define    __mApple            20000    /* Apple menu */
  30. #define    __mFile                20001    /* File menu */
  31. #define    __mEdit                20002    /* Edit menu */
  32. #define __mFont                20003    /* Font menu */
  33. #define __mSize                20004    /* Font menu */
  34. #define __mControl            20005    /* Control menu */
  35.  
  36. #define    __rMenuBar            20000    /* application's menu bar */
  37.  
  38. #define    __rAboutAlert        20000    /* about alert */
  39. #define    __rUserAlert        20001    /* user error alert */
  40. #define __rSaveAlert        20002    /* save changes alert -- when quitting is final. */
  41. #define __rQuitAlert        20003    /* quit alert -- when user has a choice. */
  42.  
  43. #define    __rDocWindow        20000    /* application's window */
  44. #define    __rVScroll            20000    /* vertical scrollbar control */
  45. #define    __rHScroll            20001    /* horizontal scrollbar control */
  46. #define    __kErrStrings        20000    /* error string list */
  47. #define __kBalloonStringsResID    20001    /* boolean help string list */
  48.  
  49. #define __rFontPrefStr        20000    /* "Monaco" text for defaut font name */
  50. #define __rResumeMenuText    20001    /* "Resume" text for "Pause" menu item */
  51. #define __rPauseMenuText    20002    /* "Pause" text for "Pause" menu item */
  52. #define __rFinderHelpString    20003    /* balloon help text for icon in finder */
  53.  
  54. #define __rOutfilePrefStr    20004    /* resource for DEFAULT_OUTFILE_NAME */
  55.     /* (only used if SavePref == 2 or 3) */
  56.  
  57. #define __rSavePref            20004
  58.     /* values:  */
  59.     /* 0 = default = DEFAULT_SAVE_PREF, save dialog will remind user to save.     */
  60.     /* 1 = save dialog will not happen, no output will be saved unless user     */
  61.     /*         choose Save or Save As. */
  62.     /* 2 = save dialog will not happen, an output file whose name is             */
  63.     /*        specified by 'STR ' __rOutfilePrefStr will be created to save the     */
  64.     /*        output, replacing any existing file with that name.                 */
  65.     /* note: for option 2, the window title is NOT set to be the filename         */
  66.     /*        specified by 'STR ' __rOutfilePrefStr. If you want it to be the        */
  67.     /*        same, define DEFAULT_WINDOW_NAME to be same as DEFAULT_OUTFILE_NAME.*/
  68.  
  69. #define __rStopPref            20005
  70.     /* values: */
  71.     /* 0 = default = DEFAULT_STOP_PREF, stop dialog will remind user that he    */
  72.     /*        can continue execution.                                             */
  73.     /* 1 = stop dialog will not be shown. If __rSavePref != 0, then the app     */
  74.     /*        exits directly to the Finder, otherwise the app will stay alive        */
  75.     /*        so the user has a chance to save the output.                        */
  76.  
  77. #define __rWindowWidthPref    20006
  78.     /* resource contains a 16-bit value that is used to set the maximum width    */
  79.     /* of the SIOW window.                                                        */
  80.  
  81.  
  82. /* The following constants are used to identify menus items. The menu IDs     */
  83. /*   have an "m" prefix and are here for continuity                            */
  84. /*   The item numbers within each menu have an "i" prefix.                     */
  85.  
  86. /* Apple menu */
  87. #define    __iAbout                1
  88.  
  89. /* File menu */
  90. #define    __iNew                    1
  91. #define    __iOpen                    2
  92. #define    __iClose                4
  93. #define __iSave                 5
  94. #define    __iSave_As                6
  95. #define    __iPageSetup            8
  96. #define    __iPrint                9
  97. #define    __iQuit                    11
  98.  
  99. /* Edit menu */
  100. #define    __iUndo                    1
  101. #define    __iCut                    3
  102. #define    __iCopy                    4
  103. #define    __iPaste                5
  104. #define    __iClear                6
  105. #define    __iSelectAll            8
  106.  
  107. /* control menu */
  108.  
  109. #define __iInputEOF                1
  110. #define __iPauseOutput            2
  111. #define __iStop                    3
  112.  
  113. /* The following are indicies into STR# __kErrStrings */
  114.  
  115. #define    __eWrongMachine            1    /* "You must run on 512Ke or later"; */
  116. #define    __eSmallSize            2    /* "Application Memory Size is too small"; */
  117. #define    __eNoMemory                3    /* "Not enough memory to run SIOW"; */
  118. #define    __eNoSpaceCut            4    /* "Not enough memory to do Cut"; */
  119. #define    __eNoCut                5    /* "Cannot do Cut"; */
  120. #define    __eNoCopy                6    /* "Cannot do Copy"; */
  121. #define    __eExceedPaste            7    /* "Cannot exceed 32,000 characters with Paste"; */
  122. #define    __eNoSpacePaste            8    /* "Not enough memory to do Paste"; */
  123. #define    __eNoWindow                9    /* "Cannot create window"; */
  124. #define    __eExceedChar            10    /* "Cannot exceed 32,000 characters"; */
  125. #define    __eNoPaste                11    /* "Cannot do Paste"; */
  126. #define    __eNofont                12    /* "Font not found"; */
  127. #define __eNoInputMoreThanReq    13     /* "Your input was longer than this program was requesting; it will be truncated." */
  128. #define __eDontNeedToSaveAgain    14
  129.  
  130. /* the following are buttons used in __rQuitAlert */
  131.  
  132. #define __kQuitCancelButton        2
  133. #define __kQuitQuitButton        1
  134.  
  135. /* the following are buttons used in __rSaveAlert */
  136.  
  137. #define __kSaveSaveButton        1
  138. #define __kSaveQuitButton        2
  139.  
  140. /* the following are buttons used in __rUserAlert (error) */
  141.  
  142. #define __kUserOKButton            1
  143. #define __kUserStaticText        2
  144. #define __kUserIcon                3
  145.  
  146. /* the following are buttons used in __rAboutAlert */
  147.  
  148. #define __kAboutOKButton        1
  149.  
  150. /* SIOW prefs */
  151.  
  152. /* use -d DEFAULT_FONT_NAME=Geneva (for example) in the rez command-line to override. */
  153.  
  154. #ifndef DEFAULT_FONT_NAME
  155.     #define DEFAULT_FONT_NAME     "Monaco"
  156. #endif
  157.  
  158. /* use -d DEFAULT_FONT_SIZE=12 (for example) in the rez command-line to override.  */
  159.  
  160. #ifndef DEFAULT_FONT_SIZE
  161.     #define DEFAULT_FONT_SIZE     9
  162. #endif
  163.  
  164. /* use -d DEFAULT_WINDOW_NAME=name in the rez command-line to override.  */
  165.  
  166. #ifndef DEFAULT_WINDOW_NAME
  167.     #define DEFAULT_WINDOW_NAME     "untitled"
  168. #endif
  169.  
  170. /* use -d DEFAULT_OUTFILE_NAME=name in the rez command-line to override.  */
  171.     
  172. #ifndef DEFAULT_OUTFILE_NAME    /* see __rSavePref above */
  173.     #define DEFAULT_OUTFILE_NAME    "output"
  174.     /* (only used if SavePref == 2) */
  175. #endif
  176.  
  177. /* use -d DEFAULT_SAVE_PREF=1 (or 2 or 3) in the rez command-line to override.  */
  178.  
  179. #ifndef DEFAULT_SAVE_PREF        /* see __rSavePref above */
  180.     #define DEFAULT_SAVE_PREF    0
  181. #endif
  182.  
  183. /* use -d DEFAULT_STOP_PREF=1 in the rez command-line to override.  */
  184.  
  185. #ifndef DEFAULT_STOP_PREF        /* see __rStopPref above */
  186.     #define DEFAULT_STOP_PREF     0
  187. #endif
  188.  
  189. /* use -d DEFAULT_WINDOW_SIZE=2048 (for example) in the rez command-line to override.  */
  190.  
  191. #ifndef DEFAULT_WINDOW_SIZE
  192.     #define DEFAULT_WINDOW_SIZE    576
  193. #endif
  194.  
  195. #ifndef STACK_SIZE
  196. #define STACK_SIZE 4096    
  197. #endif
  198.  
  199. #ifndef REZ
  200.  
  201.     /* The following are “hooks” apps can use to wrestle control from             */
  202.     /* SIOW at critical times. These variabled are defined to NULL in the SIOW     */
  203.     /* library; assign your function pointers to these variables in your         */
  204.     /* code.                                                                    */
  205.  
  206.     extern Boolean (*__siowEventHook)(EventRecord *theEvent);    
  207.         /* User event loop hook -- called when user code is executing             */
  208.         /* a read from stdin. Return true if your hook function has handled     */
  209.         /* the event and wants the SIOW library to ignore the event.             */
  210.  
  211.     extern void (*__siowWindowHook)(WindowPtr theWindow);        
  212.         /* User window is up hook -- called once when output window is created.    */
  213.  
  214.     extern void (*__siowExitHook)(Boolean abort);                
  215.         /* User “exit” hook -- called once when application is quitting.        */
  216.  
  217. #endif
  218.  
  219. #endif
  220.  
  221.